home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / machserver / 1.098 / net / netInt.h < prev    next >
C/C++ Source or Header  |  1990-10-19  |  3KB  |  103 lines

  1. /*
  2.  * netInt.h --
  3.  *
  4.  *    This defines the types and constants for the networking software.
  5.  *
  6.  * Copyright 1988 Regents of the University of California
  7.  * Permission to use, copy, modify, and distribute this
  8.  * software and its documentation for any purpose and without
  9.  * fee is hereby granted, provided that the above copyright
  10.  * notice appear in all copies.  The University of California
  11.  * makes no representations about the suitability of this
  12.  * software for any purpose.  It is provided "as is" without
  13.  * express or implied warranty.
  14.  *
  15.  *
  16.  * $Header: /sprite/src/kernel/net/RCS/netInt.h,v 9.2 90/10/19 15:45:37 jhh Exp $ SPRITE (Berkeley)
  17.  */
  18.  
  19. #ifndef _NETINT
  20. #define _NETINT
  21.  
  22. #include <sprite.h>
  23. #include <list.h>
  24. #include <bf.h>
  25. #include <net.h>
  26. #include <stdio.h>
  27. #include <stdlib.h>
  28.  
  29. /*
  30.  * The following is a NIL function pointer.
  31.  */
  32.  
  33. #define NILPROC    (void (*)()) NIL
  34.  
  35. /*
  36.  * The following macros are used to access bit fields in strings of bytes.
  37.  * The upper 24 bits of the index are the offset of the bit field, and
  38.  * the lower 8 bits are the size of the bit field.  See bf.h for info
  39.  * on the Bf macros.
  40.  */
  41.  
  42. #define NetBfByteSet(ptr, index, value)            \
  43.     Bf_ByteSet(ptr, (index) >> 8, (index) & 0xff, value)
  44.  
  45. #define NetBfByteTest(ptr, index, value)            \
  46.     Bf_ByteTest(ptr, (index) >> 8, (index) & 0xff, value)
  47.  
  48. #define NetBfByteGet(ptr, index)            \
  49.     Bf_ByteGet(ptr, (index) >> 8, (index) & 0xff)
  50.  
  51. #define NetBfShortSet(ptr, index, value)            \
  52.     Bf_HalfwordSet(ptr, (index) >> 8, (index) & 0xff, value)
  53.  
  54. #define NetBfShortTest(ptr, index, value)            \
  55.     Bf_HalfwordTest(ptr, (index) >> 8, (index) & 0xff, value)
  56.  
  57. #define NetBfShortGet(ptr, index)            \
  58.     Bf_HalfwordGet(ptr, (index) >> 8, (index) & 0xff)
  59.  
  60. #define NetBfWordSet(ptr, index, value)            \
  61.     Bf_WordSet(ptr, (index) >> 8, (index) & 0xff, value)
  62.  
  63. #define NetBfWordTest(ptr, index, value)            \
  64.     Bf_WordTest(ptr, (index) >> 8, (index) & 0xff, value)
  65.  
  66. #define NetBfWordGet(ptr, index)            \
  67.     Bf_WordGet(ptr, (index) >> 8, (index) & 0xff)
  68.  
  69. /*
  70.  * A transmission queue element.
  71.  */
  72.  
  73. typedef struct {
  74.     List_Links        links;
  75.     Net_EtherHdr    *etherHdrPtr;        /* Ethernet header with address
  76.                          * of receiver already set */
  77.     Net_ScatterGather    *scatterGatherPtr;    /* The scatter/gather array. */
  78.     int            scatterGatherLength;    /* Number of items in the 
  79.                            scatter/gather array. */
  80. } NetXmitElement;
  81.  
  82. extern    Net_EtherStats    net_EtherStats;
  83. extern    Net_Address     netEtherBroadcastAddress;
  84. extern Net_Interface    *netInterfaces[];
  85. extern int        netNumInterfaces;
  86. extern Net_Address    netZeroAddress;
  87. extern Boolean        netDebug;
  88. /*
  89.  * Procedures for the internet packet handler.
  90.  */
  91. extern void NetOutputWakeup _ARGS_((Sync_Semaphore *mutexPtr));
  92.  
  93. /*
  94.  * Forward declarations.
  95.  */
  96.  
  97. extern Net_Route *NetAllocRoute _ARGS_((void));
  98.  
  99.  
  100. extern void NetEtherInit _ARGS_((void));
  101.  
  102. #endif /* _NETINT */
  103.